package com.hn658.base.message.common.enums;

/**
 * 通知发送类型
 * Created by baihai on 2015/11/26.
 */
public enum  NotifySenderType {

    /**
     * 邮件通知
     */
    Email(0),

    /**
     * 短信通知
     */
    SMS(1),

    /**
     * JMS通知
     */
    JMS(2),

    /**
     * HTTP通知
     */
    HTTP(3),

    /**
     * Apple Push notification Service
     */
    ANPS(4),

    /**
     * Android Push notification Service
     */
    Android(5),

    /**
     * 长连接通知
     */
    Comet(6);

    /**
     * NotifySenderType对应的Value值(Int)
     */
    private int value;

    NotifySenderType(int value) {
        this.value = value;
    }

    /**
     * 获取NotifySenderType枚举对应的Value值(Int)
     *
     * @return
     */
    public int getValue() {
        return this.value;
    }

    /**
     * 根据Value值(Int)获取对应的NotifyType枚举
     *
     * @param value
     * @return
     */
    public static NotifySenderType getTypeByValue(int value) {
        for (NotifySenderType type : NotifySenderType.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }

        throw new IllegalArgumentException("未能找到匹配的NotifySenderType:" + value);
    }

}
